<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
<meta charset="UTF-8">
<title>支付页面</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="js/jquery.min.js"></script>
<script type="text/javascript" th:inline="javascript">
	function pay(){
			$.ajax(
				{
					//请求路径，要注意的是url和th:inline="javascript"
					url : [[@{/cart/pay}]],
					//请求类型
					type : "post",
					contentType : "application/json",
					//data表示发送的数据
					data : JSON.stringify({
						id : $("#oid").text()
					}),
					//成功响应的结果
					success : function(obj){//obj响应数据
						alert("支付成功");
						//获取路径
						var pathName=window.document.location.pathname;
						//截取，得到项目名称
						var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
						window.location.href = projectName;
					},
			        error : function() {
			            alert("处理异常！");
			        }
				}	
			);
	}
</script>
</head>
<body>
<div class="container">
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">订单提交成功</h3>
		</div>
		<div class="panel-body">
			<div>
				您的订单编号为<font color="red" size="5"> <span id="oid" th:text="${order.id}"></span></font>	。<br><br>
				<a href="javascript:pay()">去支付</a>
			</div>
		</div>
	</div>
</div>
</body>
</html>